package com.qo.qsdk.ui.base.floater.animation;

import android.app.Activity;
import android.view.View;
import android.view.animation.AlphaAnimation;

import com.qo.qsdk.utils.QSDKHelper;

public class AlphaValueAnimation {
    private View mView;
    private AlphaAnimation mAlphaAnimation;

    public AlphaValueAnimation(View view, float toAlpha, long durationMillis) {
        super();
        mView = view;
        mAlphaAnimation = new AlphaAnimation(1.0f, toAlpha);
        mAlphaAnimation.setDuration(durationMillis);
        mAlphaAnimation.setFillAfter(true);
    }

    public void startAnimation() {
        QSDKHelper.getHandler().post(new Runnable() {
            @Override
            public void run() {
                mView.startAnimation(mAlphaAnimation);
            }
        });
    }

    public void clearAnimation() {
        mView.clearAnimation();
    }
}
